home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of MacTutor - S…e Code for Volumes 1 to 5
/
The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin
/
Source Code
/
#50 (Nov 89)
/
MIDIArp.Application
/
MIDIArp.Application⁄NO LICENSE
/
MIDIArp.h
< prev
next >
Wrap
Text File
|
1989-06-09
|
4KB
|
203 lines
/*
File: MIDIArp.h
Usage: MIDI Manager Arpeggiator Program.
Purpose: Apple MIDI Manager Demo.
Authors: Fred Malouf,
Don Marsh,
Don Veca.
Date: April 1989
*/
/* Standard Menu Constants */
#define menuBar 128 /* Application's menu bar ID */
#define appleMenu 128 /* Apple Menu */
#define aboutItem 1
#define fileMenu 129 /* File Menu */
#define closeItem 4
#define quitItem 12
#define editMenu 130 /* Edit Menu */
#define undoItem 1
#define cutItem 3
#define copyItem 4
#define pasteItem 5
#define clearItem 6
/* Main Dialog Res and Item ID's */
#define mainDialogID 2000
#define quitID 1
#define patternPromptID 2
#define patternUpID 3
#define patternDownID 4
#define patternUpDownID 5
#define patternDownUpID 6
#define patternRandomID 7
#define speedPromptID 8
#define speedVeryFastID 9
#define speedFastID 10
#define speedMediumID 11
#define speedSlowID 12
#define speedVerySlowID 13
/* Alert Box Res ID's */
#define arpAlertBoxID 12345
#define arpAboutAlertID 13554
/*
MIDIArp Time, Input, and Output Port
Info Record Resource ID's.
*/
#define portResType 'port'
#define timePortResInfoID 128
#define inputPortResInfoID 129
#define outputPortResInfoID 130
/* MIDIArp Constants */
#define noteTblSize 32
#define goingUp 1
#define goingDown 0
#define speedVeryFast 50 /* Time in milliseconds */
#define speedFast 100
#define speedMedium 200
#define speedSlow 300
#define speedVerySlow 500
#define noteDuration (ArpGlobals.Tempo * 0.95)
/*
MIDIMgr Constants
*/
#define arpClientID 'MArp'
#define arpIcon 128
#define timePortID 'Atim'
#define inputPortID 'Bin '
#define outputPortID 'Cout'
#define keyOnOffPacketSize 9
#define stdPacketFlags 0
#define flagsTimeStampMask 0x7F
#define noTimeBaseRefNum 0
#define noClient ' '
#define noReadHook 0L
#define noTimeProc 0L
#define zeroTime 0L
#define zeroPeriod 0L
#define refCon0 0L
#define timePortBuffSize 0L
#define inputPortBuffSize 2048
#define outputPortBuffSize 0L
/* Misc Constants */
#define charEnterKey 0x03
// KeyOn KeyOff data structure.
typedef struct
{ unsigned char Channel;
unsigned char Note;
unsigned char Velocity;
unsigned char Dummy; // Makes struct even.
} NoteInfo;
// Main MIDIArp Data Structure.
typedef struct
{ short Locked; // Don't modify this structure while MIDIWakeUp active.
NoteInfo NoteTbl[noteTblSize]; // Which notes to arpeggiate.
long NoteIndex; // Index into note table.
short NumNotes; // Number of notes in NoteTbl.
NoteInfo LastNote; // Most recently played note.
short ArpPattern; // Chord ArpPattern.
short ArpDirection; // Chord direction.
long Tempo; // Tempo of arpeggiated notes.
long NextNoteOnTime; // Time to play next note.
short InputRefNum; // Input port reference number.
short OutputRefNum; // Output port reference number.
short TimeRefNum; // Time base port reference number.
} ArpParams;
//
// Function protocalls.
//
extern void
InitThings(void);
extern void
ArpInit(void);
extern void
StartDialog(void);
extern void
RunDialog(void);
extern void
ArpClose(void);
extern void
StopDialog(void);
extern pascal short
ArpReader(MIDIPacketPtr ThePacketPtr, long TheRefCon);
extern pascal void
ArpTimeProc(long TheCurTime, long TheRefCon);
extern void
BumpNoteTableIndex(void);
extern void
PatchPorts(void);
extern void
SavePatch(OSType PortID, short PortInfoResID, char *PortInfoResName);
extern char *
StdMacVerNumToStr(long VerNum, char *VerStr);
extern void
Terminate(void);
extern void
AdjustMenus(void);
extern void
DoMenuCommand(long MenuResult);
extern void
StdSaveDLOGLocation(DialogPtr TheDialogPtr, short TheDialogID);
extern void
StdAdjustDLOGLocation(DialogPtr TheDialogPtr);
extern void
SwitchRadio(DialogPtr TheDialog, short *CurRadio, short NextRadio);
extern void
ChangeState(DialogPtr TheDialog, short State, short ItemNo);
extern void
ArpAlert(char *TheMessage);
extern char *
C2PStrCpy(char *Cstr, Str255 Pstr);
extern Boolean
IsDAWindow(WindowPtr Window);
extern Boolean
IsAppWindow(WindowPtr Window);
extern void
StdHiliteButton(DialogPtr TheDialog, short TheItemID);
extern short
Seed(void);
extern short
Choose(short Max);
extern void
ReportResError(char *Msg);